<?php /* SVN: $Id: $ */ ?>
<div class="mail-right-block grid_6">
<div class="l-curve-top">							
	<div class="r-curve-top">
		<div class="top-bg"></div>
	</div>
						</div>
						<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">
								<div class="main-section">
	<h3 class="mail-head"><?php echo __l('Mail'); ?> </h3>

		<?php echo $this->element('message_message-left_sidebar', array('config' => 'sec')); ?>
		
	</div>
	</div>
							</div>
						</div>
						<div class="l-curve-bot">							
							<div class="r-curve-bot">
								<div class="bot-bg"></div>
							</div>
						</div>
</div>
<div class="messages message-side2 grid_18">
<div class="l-curve-top">							
		<div class="r-curve-top">
			<div class="top-bg"></div>
		</div>
						</div>
						<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">
<div class="main-section js-corner round-5">
<div class="mail-side-two">
	<?php
        echo $this->Form->create('Message', array('action' => 'move_to','class' => 'normal'));
        echo $this->Form->hidden('folder_type', array('value' => $folder_type,'name' => 'data[Message][folder_type]'));
        echo $this->Form->hidden('is_starred', array('value' => $is_starred,'name' => 'data[Message][is_starred]'));
        echo $this->Form->hidden('label_slug', array('value' => $label_slug,'name' => 'data[Message][label_slug]'));
        echo $this->Form->hidden("Message.Id." . $message['Message']['id'], array('value' => '1'));
		echo $this->Form->input('js-view-message',array('type' => 'hidden', 'id'=>'js-view-message', 'value' => 'view-message'));
    ?>
    <div class="mail-main-curve">
			<div>
			<?php
                if (!empty($label_slug) && $label_slug != 'null') :
                    echo $this->Html->link(__l('Back to Label') , array('controller' => 'messages','action' => 'label',$label_slug),array('class'=>'bk-icon'));
                elseif (!empty($is_starred)) :
                    echo $this->Html->link(__l('Back to Starred') , array('controller' => 'messages','action' => 'starred'),array('class'=>'bk-icon'));
                else :
                    echo $this->Html->link(__l('Back to') . ' ' . $back_link_msg, array('controller' => 'messages','action' => $folder_type), array('class'=>'bk-icon'));
                endif;
            ?>
			</div>
			<div class="message-block clearfix">
				<div class="message-block-left  grid_7 alpha"  >
			<?php echo $this->Form->input('more_action_1', array('type' => 'select','options' => $mail_options,'label' => false,'class' => 'js-apply-message-action'));?>
			</div>
			<div class="message-block-right grid_right">
    			<?php
                    echo $this->Form->submit(__l('Spam'), array('name' => 'data[Message][ReportSpam]'));
                    echo $this->Form->submit(__l('Delete'), array('name' => 'data[Message][Delete]'));
                ?>
			</div>
        </div>
		<div class="mail-body js-corner round-5">
			<?php
				if (!empty($all_parents)) :
					foreach($all_parents as $parent_message):
			?>
						<div class="js-show-mail-detail-div">
							<p>
								<span class="show-details-left"><?php echo __l('From').': '; ?></span>
								<?php echo $parent_message['OtherUser']['username']; ?>
							</p>
							<p>
								<span class="show-details-left"><?php echo __l('To').': '; ?></span>
								<?php echo $parent_message['User']['username']; ?>
							</p>
							<p>
								<span class="show-details-left"><?php echo __l('Date').': '; ?></span>
								<?php
									echo $this->Html->cDateTimeHighlight($parent_message['Message']['created']);
								?>
							</p>
							<?php if (!empty($parent_message['Message']['project_id'])) :?>
								<p>
									<span class="show-details-left"><?php echo __l('Project').': '; ?></span>
									<?php echo $this->Html->link($parent_message['Project']['name'], array('controller' => 'projects', 'action' => 'view', $parent_message['Project']['slug']), array('escape' => false, 'title' => $parent_message['Project']['slug']));?>
								</p>
							<?php endif;?>
    						<p>
								<span class="show-details-left"><?php echo __l('Subject').': '; ?> </span>
								<?php echo $this->Html->cText($parent_message['MessageContent']['subject']); ?>
							</p>
                        </div>
						<?php if (!empty($backerReward)) :?>
							<dl>
								<dt><?php echo __l('Pledge'); ?></dt>
								</dd><?php echo $backerReward['ProjectFund']['amount']; ?></dd>
								<dt><?php echo __l('Reward'); ?></dt>
								</dd><?php echo $backerReward['ProjectReward']['reward']?$backerReward['ProjectReward']['reward']:__l('No reward'); ?></dd>
							</dl>
						<?php endif;?>
						<div class="message-view-content clearfix">
							<span class="c"><?php echo $this->Html->cHtml(nl2br($parent_message['MessageContent']['message'])); ?></span>
						</div>
			<?php
					endforeach;
				endif;
			?>
				<div class="mail-content-curve-middle">
					<div class="js-show-mail-detail-div show-mail">
						<?php if ($message['Message']['is_sender'] == 0) : ?>
							<p><span class="show-details-left"><?php echo __l('From') . ': ';  ?></span> <?php echo $message['OtherUser']['username']; ?></p>
						<?php else: ?>
							<p><span class="show-details-left"><?php echo __l('From') . ': ';  ?></span> <?php echo $message['User']['username']; ?></p>
						<?php endif; ?>
						<p><span class="show-details-left"><?php echo __l('To') . ': ';  ?></span><?php echo $show_detail_to; ?></p>
						<p><span class="show-details-left"><?php echo __l('Date') . ': ';  ?></span><?php echo $this->Html->cDateTimeHighlight($message['Message']['created']); ?></p>
						<?php if (!empty($message['Message']['project_id'])) :?>
							<p><span class="show-details-left"><?php echo __l('Project') . ': '; ?></span><?php echo $this->Html->link($message['Project']['name'], array('controller' => 'projects', 'action' => 'view', $message['Project']['slug']), array('escape' => false, 'title' => $message['Project']['slug']));?></p>
						<?php endif;?>
						<p><span class="show-details-left"><?php echo __l('Subject').': ';  ?></span><?php echo $this->Html->cText($message['MessageContent']['subject']); ?> </p>
					</div>
					<div class="message-view-content">
						<?php  echo $this->Html->cHtml(nl2br($message['MessageContent']['message'])); ?>
					</div>
					<ul class="replay-forward-links list clearfix">
				<li><?php echo $this->Html->link(__l("Reply") , array('controller' => 'messages','action' => 'compose',$message['Message']['id'],'reply'), array('class'=>'reply')); ?></li>
				</ul>
                <div class="download-block">
                <?php
                if (!empty($message['MessageContent']['Attachment'])) :
					?>
					<h4><?php echo count($message['MessageContent']['Attachment']).' '. __l('attachments');?></h4>
					<ul>
					<?php
                    foreach($message['MessageContent']['Attachment'] as $attachment) :
                ?>
					<li>
                	<span class="attachement"><?php echo $attachment['filename']; ?></span>
                	<span><?php echo bytes_to_higher($attachment['filesize']); ?></span>
                    <span><?php echo $this->Html->link(__l('Download') , array( 'action' => 'download', $message['Message']['id'], $attachment['id'])); ?></span>
					</li>
                <?php
                    endforeach;
				?>
				</ul>
				<?php
                endif;
                ?>
                </div>
            </div>
       </div>
        <div class="message-block clearfix">
        <div class="message-block-left grid_7 alpha">
			<?php
            echo $this->Form->input('more_action_2', array('type' => 'select','options' => $mail_options,'label' => false,'class' => 'js-apply-message-action2' ));
            ?>
			</div>

        <div class="message-block-right grid_right">
        <?php
            echo $this->Form->submit(__l('Spam'), array( 'name' => 'data[Message][ReportSpam]'));
            echo $this->Form->submit(__l('Delete'), array('name' => 'data[Message][Delete]'));
        ?>
        </div>
        </div>
<p class="back-to-inbox">
    <?php
    if (!empty($label_slug) && $label_slug != 'null') :
        echo $this->Html->link('Back to Label', array( 'controller' => 'messages','action' => 'label', $label_slug), array('class'=>'bk-icon'));
    elseif (!empty($is_starred)) :
        echo $this->Html->link('Back to Starred', array('controller' => 'messages','action' => 'starred'), array('class'=>'bk-icon'));
    else :
        echo $this->Html->link(__l('Back to') . ' ' . $back_link_msg, array('controller' => 'messages','action' => $folder_type), array('class'=>'bk-icon'));
    endif;
    ?>
</p>
     </div>
	<?php echo $this->Form->end();
?>
</div>
</div>
	</div>
							</div>
						</div>
						<div class="l-curve-bot">							
							<div class="r-curve-bot">
									<div class="bot-bg"></div>
							</div>
						</div>
</div>
